package com.demo5;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import kong.unirest.core.HttpResponse;
import kong.unirest.core.Unirest;

public class UnirestTest {

    public static void main(String[] args) throws JsonProcessingException {
        HttpResponse<String> response = Unirest.post("http://127.0.0.1:8015/home/sort_theme")
                .header("Authorization", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJRCI6MSwiTmlja05hbWUiOiIiLCJBdXRob3JpdHlJZCI6MCwiUm9sZSI6IiIsImlzcyI6Ikd5bCIsImV4cCI6MTc0NTM3NDk5OSwibmJmIjoxNzQ1Mjg4NTk5fQ.aKCtVCrBcL-XTZ3M9UdpUdxUioMNEyPInG3byyynhNg")
                .multiPartContent()
                .field("ids", "1,2,3,4,5,6,7,8,9,10,11,12,13,14,18,16,17,15")
                .field("did", "1")
                .asString();

        String a = response.getBody();
        ObjectMapper mapper = new ObjectMapper();
        JsonNode node = mapper.readTree(a);
        System.out.println(a);
        System.out.println(node.get("message"));
    }
}
